<?php
namespace app\admin\Controller;
use think\Request;

class System extends Common
{

   	//系统消息列表
    public function lists(){
    	$list = db('system_letter')->order('creatime desc')->paginate(10);

		  $this->assign('data',$list);
      return $this->fetch();
    }
    
    //添加系统消息
    public function add_system(){
      $data['title'] = input('title');
      $data['content'] = input('content');
      $data['creatime'] = time();

      if(request()->isPost()){
        $res=db("system_letter")->insert($data);

        if(!$res)$this->error("操作失败！");
        $this->redirect(url('system/lists'));
      }

      return $this->fetch();
    }
   
}